package com.vcredit.creditcat.model;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

/**
 * 
 **/
@SuppressWarnings("deprecation")
public class User implements Serializable, UserDetails {
	private static final long serialVersionUID = -1L;
	/** id **/
	private java.lang.Long userId;
	/** 用户名 **/
	private java.lang.String userName;
	/** 昵称 **/
	private java.lang.String nickName;
	/** 密码 **/
	private java.lang.String userPwd;
	/** 电话 **/
	private java.lang.String userPhone;
	/** 用户状态 **/
	private java.lang.Integer userStatus;
	/** 创建时间 **/
	private java.util.Date createTime;
	/** 最新修改时间 **/
	private java.util.Date updateTime;
	/** 用户角色名集合  **/
	private String roleNames;
	/** 用户角色Id集合 **/
	private String roleIds;

	public java.lang.Long getUserId() {
		return userId;
	}

	public void setUserId(java.lang.Long userId) {
		this.userId = userId;
	}

	public java.lang.String getUserName() {
		return userName;
	}

	public void setUserName(java.lang.String userName) {
		this.userName = userName;
	}

	public java.lang.String getUserPwd() {
		return userPwd;
	}

	public void setUserPwd(java.lang.String userPwd) {
		this.userPwd = userPwd;
	}

	public java.lang.Integer getUserStatus() {
		return userStatus;
	}

	public void setUserStatus(java.lang.Integer userStatus) {
		this.userStatus = userStatus;
	}

	public java.util.Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(java.util.Date createTime) {
		this.createTime = createTime;
	}

	public java.util.Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(java.util.Date updateTime) {
		this.updateTime = updateTime;
	}

	public java.lang.String getUserPhone() {
		return userPhone;
	}

	public void setUserPhone(java.lang.String userPhone) {
		this.userPhone = userPhone;
	}

	public java.lang.String getNickName() {
		return nickName;
	}

	public void setNickName(java.lang.String nickName) {
		this.nickName = nickName;
	}

	public String getRoleNames() {
		return roleNames;
	}

	public void setRoleNames(String roleNames) {
		this.roleNames = roleNames;
	}

	public String getRoleIds() {
		return roleIds;
	}

	public void setRoleIds(String roleIds) {
		this.roleIds = roleIds;
	}

	public Collection<GrantedAuthority> getAuthorities() {
		return null;
	}

	public String getUsername() {
		
		return this.userName;
	}

	public boolean isAccountNonExpired() {
		
		return true;
	}

	public boolean isAccountNonLocked() {
		
		return true;
	}

	public boolean isCredentialsNonExpired() {
		
		return true;
	}

	public boolean isEnabled() {
		
		return this.userStatus == null ? false : this.userStatus == 1 ? true
				: false;
	}

	public User() {
		super();
	}

	public User(Long userId, Integer userStatus) {
		super();
		this.userId = userId;
		this.userStatus = userStatus;
	}

	public User(Long userId, String userPwd) {
		super();
		this.userId = userId;
		this.userPwd = userPwd;
	}

	public User(Long userId, String userName, String nickName,
			String userPwd, String userPhone, Integer userStatus,
			Date createTime, Date updateTime) {
		super();
		this.userId = userId;
		this.userName = userName;
		this.nickName = nickName;
		this.userPwd = userPwd;
		this.userPhone = userPhone;
		this.userStatus = userStatus;
		this.createTime = createTime;
		this.updateTime = updateTime;
	}

	public User(String userName) {
		super();
		this.userName = userName;
	}

	@Override
	public String getPassword() {

		return userPwd;
	}

}